package com.demo.fomatback.demos.web.controller;

import com.demo.fomatback.demos.web.vo.Format;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @FileName: FormatController
 * @Date: 2024-03-28:15:38
 * @Description:
 * @Author: Miao
 */
@RestController
public class FormatController {
    @RequestMapping ("/format")
    @ResponseBody
    public Format getFormat(@RequestBody Format format){
        String original = format.getOriginal();
        String replace = format.getReplace();
        String eventual = original.replaceAll("\\n|\\r\\n",replace);
        format.setEventual(eventual);
        return format;
    }
}
